package com.kevin.model;

import java.util.Date;
import java.util.List;

import lombok.Data;

import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Many;
import org.nutz.dao.entity.annotation.One;
import org.nutz.dao.entity.annotation.Table;

import com.kevin.validate.annotation.Validations;


/**
 * 文章类
 * 
 * @author gevin(gevinhjy@foxmail.com)
 * 
 */
@Table("ArticleInfo")
public @Data class ArticleInfo {

	@Id
	private int id;
	@Column
	//账号验证规则，与字符串长度区间验证共同作用   
	@Validations(account = true, strLen = { 3, 16 }, errorMsg = "标题不符合要求")   
	private String title;
	@Column
	private String content;
	@Column
	private Date addDate;
	@Column
	private String addIp;
	@Column("uid")
	private int addUserId;
	
	@One(target = UserInfo.class, field = "addUserId")
	private UserInfo addUser;
	
	@Many(target = ArticleAttachment.class, field = "artinfoid")
	private List<ArticleAttachment> attachments;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getAddDate() {
		return addDate;
	}

	public void setAddDate(Date addDate) {
		this.addDate = addDate;
	}

	public String getAddIp() {
		return addIp;
	}

	public void setAddIp(String addIp) {
		this.addIp = addIp;
	}

	public int getAddUserId() {
		return addUserId;
	}

	public void setAddUserId(int addUserId) {
		this.addUserId = addUserId;
	}

	public UserInfo getAddUser() {
		return addUser;
	}

	public void setAddUser(UserInfo addUser) {
		this.addUser = addUser;
	}

}
